package vn.sunnet.game.SinhTon.object;

import java.util.ArrayList;

import vn.sunnet.game.SinhTon.global.Assets;

import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class PlusScore {
	private float x, y;
	private ArrayList<TextureRegion> arrTexture; //mang luu dau cong va cac so
	private float alpha;

	public PlusScore(int number, float x, float y) {
		this.x = x;
		this.y = y;
		alpha = 1;
		TextureRegion bigNumber = new TextureRegion(Assets.ttNumber);
		ArrayList<Integer> characters = new ArrayList<Integer>();
		arrTexture = new ArrayList<TextureRegion>();
		do {
			characters.add(number % 10);
			number = number / 10;
		} while (number > 0);

		arrTexture.add(new TextureRegion(Assets.ttPlusScore));

		for (int i = characters.size() - 1; i >= 0; i--) {
//			Gdx.app.log("number", String.valueOf(characters.get(i)));
			TextureRegion numberTexture = new TextureRegion(bigNumber,
					characters.get(i) * 136, 0, 136, 157);
			arrTexture.add(numberTexture);
		}
	}

	public float getX() {
		return x;
	}

	public float getY() {
		return y;
	}

	public float getWidthOneNumber() {
		return 20;
	}

	public float getHeight() {
		return 50;
	}

	public void move(float delta) {
		alpha -= delta;
		if (alpha < 0) {
			alpha = 0;
		}
		y += 2;
	}

	public boolean isEnd() {
		return y > 720;
	}

	public ArrayList<TextureRegion> getTexture() {
		return arrTexture;
	}

	public float getAnpha() {
		return alpha;
	}

}
